#ifndef TDLG_H
#define TDLG_H

#include "twin.h"

struct WINPOS 
{
	int		x;
	int		y;
	int		cx;
	int		cy;
};

enum DlgItemFlags 
{
	NONE_FIT	= 0x000,
	LEFT_FIT	= 0x001,
	RIGHT_FIT	= 0x002,
	TOP_FIT		= 0x004,
	BOTTOM_FIT	= 0x008,
	FIT_SKIP	= 0x800,
	X_FIT		= LEFT_FIT|RIGHT_FIT,
	Y_FIT		= TOP_FIT|BOTTOM_FIT,
	XY_FIT		= X_FIT|Y_FIT,
};

struct DlgItem 
{
	DWORD	flags;	// DlgItemFlags
	HWND	hWnd;
	WINPOS	wpos;
};

class TDlg : public TWin 
{
public:
	TDlg(UINT	resid, TWin *parent = NULL);
	virtual ~TDlg();

	virtual BOOL Create(HINSTANCE hI = NULL);
	virtual	void Destroy(void);
	virtual int	 Exec(void);
	virtual void EndDialog(int);
	UINT		 ResId(void) { return _resId; }
	virtual int	 SetDlgItem(UINT ctl_id, DWORD flags=0);
	virtual BOOL FitDlgItems();

	virtual BOOL EvCreate(LPARAM lParam);
	virtual BOOL EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl);
	virtual BOOL EvSysCommand(WPARAM uCmdType, POINTS pos);
	virtual BOOL EvQueryOpen(void);

	virtual	BOOL	PreProcMsg(MSG *msg);
	virtual LRESULT	WinProc(UINT uMsg, WPARAM wParam, LPARAM lParam);

protected:
	UINT	_resId;
	BOOL	_modalFlg;
	int		_maxItems;
	DlgItem* _dlgItems;
};


#endif	// TDLG_H